package com.learn.drools.utils;

import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;

import java.util.Collection;

public class KieFactory {
    private static KieContainer kContainer;
    static {
        KieServices kieServices = KieServices.Factory.get();
        kContainer = kieServices.getKieClasspathContainer();
        Collection<String> baseNames = kContainer.getKieBaseNames();
        baseNames.forEach(e->System.out.println(e));
    }

    public static KieContainer getkContainer() {
        return kContainer;
    }

    public static KieBase getkKieBase(String KBaseName) {
        return kContainer.getKieBase(KBaseName);
    }
}
